﻿/****************************************************************
 * Copyright (c) 2010-2013 Besture All Rights Reserved.
 * 
 * File Name:		Query 
 * 
 * Created:		2013-8-28 18:59:33
 * Original Author:	nitao 
 * 
 * ------------------------------------------------------------
 * MODIFICATION HISTORY
 * ------------------------------------------------------------
 * When			Who		Why
 * ------------------------------------------------------------
 * 
 *
 ****************************************************************/

using System;
using System.Data;
using Besture.Common;
using Besture.Dal;

namespace Besture.Bll
{
    public class QueryDac : BaseFacade
    {
        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <returns></returns>
        public DataTable GetDataTable(string sql)
        {
            try
            {
                QueryDal queryDal = new QueryDal();
                // create the connection to the database
                CreateConnection();
                return queryDal.GetTable(sql);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // close the connection with the database
                CloseConnection();
            }
        }

        /// <summary>
        /// 获取查询数据
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public static DataTable GetTable(string sql)
        {
            QueryDac queryDac = new QueryDac();
            return queryDac.GetDataTable(sql);
        }
    }
}
